package com.erlin.common.api;

import com.erlin.common.utils.FileUploadUtil;
import com.erlin.common.vo.FileUploadResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/fileUpload")
@Api(tags = "文件接口")
public class FileUploadController {
    @Autowired
    private FileUploadUtil fileUploadUtil;

    @PostMapping("/upload")
    @ApiOperation("文件上传")
    public FileUploadResultVo upload(@RequestBody MultipartFile file){
        return fileUploadUtil.uploadImg(file);
    }
}
